const {mysql} = require('../qcloud')
//获取攻略列表的信息
module.exports = async (ctx) => {
  const {openid} = ctx.request.query
  
  try{
    const strategy = await mysql('strategy')
                              .select('sid','sbiao','ssrc','nssrc','szheng','wx_name','avatarurl','create_time','openid')//sid攻略的id 
                              
                              .orderBy('sid','desc') //降序
    // 执行成功返回的数据
    ctx.state.data = {
      strategy
    }
  }catch(e){
    // 执行失败返回的数据
    ctx.state = {
      code: -1,
      data: {
        msg: '获取失败' + e.sqlMessage
      }
    }
  }
}
